﻿using log4net;
using OneWorks.DataBase.Entity;
using OneWorks.Repositories.EntityFramework;


namespace OneWorks.Application
{
    using Interface;
    using Repositories;

    public abstract class BaseService : IService
    {
        protected ILog Log;
        protected RepositoryContext RepositoryContext;

        static BaseService()
        {
            StaticInitialization();
        }

        protected BaseService()
        {
            Initialization();
        }

        private static void StaticInitialization()
        {
            AutoMapper.Mapper.CreateMap<User, Entity.User>();
            AutoMapper.Mapper.CreateMap<Entity.User, User>();
        }

        private void Initialization()
        {
            Log = Utils.Log.LogHandler.Log;
            RepositoryContext = new EntityFrameworkRepositoryContext(); 
        }
    }
}
